let walk = require('./walk')
let acorn = require('acorn')
const options = require("../rollup.config");
let fs = require('fs');
let code = fs.readFileSync(options.input)
let ast = acorn.parse(code,{
  locations:true,ranges:true,sourceType:'module',ecmaVersion:8
});
let ident = 0;
const padding = ()=>{
  return " ".repeat(ident);
}
ast.body.forEach(statement => {
  walk(statement,{
    enter(node){
      if(node && node.type){
        console.log(padding()+node.type);
        ident +=2;
      }
    },
    leave(node){
      if(node && node.type){
        ident -=2;
        console.log(padding()+node.type);
      }
    }
  })
});